import React, {Component} from 'react'

class Cont extends Component {
    constructor(props) {
        super(props)
        this.state = {
            value: ''
        }
    }

    handleInput = _event => {
        let event = _event
        let elem = event.target
        let value = elem.value
        if(elem.attributes.twoWay != null){
            let attr = elem.attributes.twoWay.value
            this.setState(state => state[attr] = value)
        }
    }

    render() {
        return (
            <div>
                <input onInput={this.handleInput}  twoWay={'value'} />
                <p>{this.state.value}</p>
            </div>
        )
    }
}

export default Cont;